package com.cavy.platform.client.message;

import com.cavy.platform.client.domain.ContainerInfo;
import com.cavy.platform.client.domain.RunningParameter;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * Created by tangxu on 18-7-30.
 */
@EqualsAndHashCode(callSuper = true)
@Data
public class ContainerExecutedFailMessage extends ContainerExecutedSuccessMessage {
    private String runExceptionMessage;
    private String exitCode;
    private boolean timeOut;

    public ContainerExecutedFailMessage(Exception runException, String exitCode, boolean timeOut,
                                        RunningParameter parameter, int index, ContainerInfo containerInfo) {
        super(parameter, containerInfo, index);
        if (runException != null) {
            this.runExceptionMessage = runException.getMessage();
        }
        this.exitCode = exitCode;
        this.timeOut = timeOut;
    }

    public ContainerExecutedFailMessage(String message, String exitCode, boolean timeOut,
                                        RunningParameter parameter, int index, ContainerInfo containerInfo) {
        super(parameter, containerInfo, index);
        this.runExceptionMessage = message;
        this.exitCode = exitCode;
        this.timeOut = timeOut;
    }
}
